home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / bbsxdemo.lzh / UTILS.SIG / TIM_LIM.LZH / TIM_LIM.SCR
Text File  |  1992-09-05  |  5KB  |  148 lines

  1. SCRIPT
  2.  
  3.  
  4. ; ---------------------------------------------------------------
  5. ;
  6. ;  FILE NAME:         TIM_LIM.SCR
  7. ;  DATE               4 September 1992
  8. ;  VERSION:           1.00
  9. ;  BY:                R. Sanchez, C&R Systems
  10. ;  PURPOSE:           Sample Script file showing one use of the
  11. ;                     TIME_LIMIT Script Command.
  12. ;
  13. ; ---------------------------------------------------------------
  14. ; ----------- COPYRIGHT 1992, R. SANCHEZ, C&R SYSTEMS -----------
  15. ; ---------------------------------------------------------------
  16. ;
  17. ;  1.  Example of one use of the TIME_LIMIT Script Command.
  18. ;
  19. ;  2.  Allow a user to do specific functions and not have their
  20. ;  time limit remaining reduced.  We do not actually prevent
  21. ;  their time limit from being reduced, we keep track of what
  22. ;  their time limit was at the beginning of a Script, and at the
  23. ;  end, we set it back with the  TIME_LIMIT Script Command.
  24. ;
  25. ; ---------------------------------------------------------------
  26.  
  27.    ;  Define variables.  Those variables which take values of the
  28.    ;  Ampersand variables are established by using the SET
  29.    ;  command rather than by the "DEFINE Variable = &nn".  Some
  30.    ;  variables assigned in this manner require that the Script
  31.    ;  File be compiled.
  32.  
  33. DEFINE Minutes_to_hold          ;
  34. SET Minutes_to_hold = &33       ; Minutes remaining right now
  35.  
  36.  
  37.    ;  Just to show what the time related variables are set to.
  38.  
  39. PRINTE 'Time limit per call:  &13'
  40. PRINTE 'Time limit per day:   &14'
  41. PRINTE 'Minutes on today:     &15'
  42. PRINTE 'Minutes connected:    &32'
  43. PRINTE 'Minutes remaining :   &33'
  44. PRINTE 'System Time:          &34'
  45. PRINTE
  46. PRINTE 'Press Control C when you wish to abort.'
  47. PRINTE 'Minutes remaining will be set as shown above.'
  48. PRINTE
  49. PRINTE '  TIME    Minutes remaining'
  50. PRINTE '--------  -----------------'
  51.  
  52. ; ---------------------------------------------------------------
  53.  
  54.    ;  Goto the label Set_time_ when the user presses "Control C"
  55.    ;  or "Control X".
  56. ABORT Set_time_
  57.  
  58. DEFINE New_Minutes_remaining
  59. DEFINE Delay
  60.  
  61. Do_it_again_:
  62.  
  63.    ;  Just a delay loop
  64. FOR Delay = 1 to 50
  65. ENDFOR
  66.  
  67.    ;  Get the user's current remaining minutes allowed on this
  68.    ;  call.
  69. SET New_Minutes_remaining = &33
  70.  
  71.    ;  Some formatting for our display.  Set the variable string
  72.    ;  to four characters in length.
  73. EXPAND (New_Minutes_remaining, 4)
  74.  
  75.    ;  Erase the line of printed text...
  76. BACKSPACE (21)
  77.  
  78.    ;  ...Write a new line in its place.
  79. PRINT '&34        [New_Minutes_remaining]'
  80.  
  81.    ;  Delay the printed line long enough so we can see it.
  82. FOR Delay = 1 to 1500
  83. ENDFOR
  84.  
  85.    ;  Just some more formatting, overwrite the line with
  86.    ;  something else so that it is obvious that something is
  87.    ;  happening.
  88. BACKSPACE (21)
  89. PRINT '*********************'
  90.  
  91.    ;  Just keep looping forever until an abort is sensed by the
  92.    ;  ABORT Set_time_ and then goto Set_time_:
  93. GOTO Do_it_again_
  94.  
  95. ; ---------------------------------------------------------------
  96.  
  97.    ;  Aborted was sensed, now to do the actual setting of the
  98.    ;  users Time Limit.
  99.  
  100. Set_time_:
  101.  
  102.    ;  The main point of this Script program.  To allow a user to
  103.    ;  do specific functions and not have their time limit
  104.    ;  remaining reduced.
  105.  
  106. DEFINE Time_limit_to_hold = 0
  107. DEFINE Current_minutes_connected
  108.  
  109.    ;  The users "TIME_LIMIT" for purposes of performing these
  110.    ;  tasks can be considered to be their "Minutes Remaining"
  111.    ;  (variable &33) plus their "Minutes Connected" (variable
  112.    ;  &32).
  113.    ;
  114.    ;  We initially set the variable Minutes_to_hold the value of
  115.    ;  the &33 variable to keep track of the users original
  116.    ;  minutes remaining.  We add that to the Time_limit_to_hold
  117.    ;  variable.
  118.    ;
  119.    ;  We then take the "Current_minutes_connected" variable and
  120.    ;  also add that to the Time_limit_to_hold variable.
  121.    ;
  122.    ;  We use the INCREASE variable (variable) command to do the
  123.    ;  adding.  We end up with the value contained in the
  124.    ;  Time_limit_to_hold variable holding the amount of time
  125.    ;  needed to be used with the "TIME_LIMIT" command.
  126.  
  127.  
  128.    ;  Get how long they have been connected.
  129. SET Current_minutes_connected = &32
  130.  
  131. INCREASE Time_limit_to_hold (Minutes_to_hold)
  132. INCREASE Time_limit_to_hold (Current_minutes_connected)
  133.  
  134. TIME_LIMIT (Time_limit_to_hold)
  135.  
  136. PRINTE
  137. PRINTE 'Minutes remaining has been set to &33'
  138.  
  139. ; ---------------------------------------------------------------
  140.  
  141.    ;  Just a habit...
  142. EOF:
  143. DEFAULT_PATH
  144. EXIT
  145.  
  146. ; ---------------------------------------------------------------
  147.  
  148.